package com.code.dao;

import com.code.entity.HistoryLine;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 历史时间线
 * @author wwei
 * @date 2019/8/7
 */
@Repository
public interface IHistoryLineDao extends JpaRepository<HistoryLine,Long> {

    /**
     * 获取用户历史时间线数据
     * @param userId 用户id
     * @return 历史数据
     */
    @Query(value = "select * from history_line where user_id = ?1 order by create_time desc", nativeQuery = true)
    List<HistoryLine> findByUserId(Long userId);
}
